Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: collapse relevant DefPathData variants into {Type,Value,Macro,Lifetime}Ns. #60525

Merged
merged 3 commits into from
May 5, 2019

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented May 3, 2019

DefPathData was meant to disambiguate within each namespace, but over the years, that purpose was overlooked, and it started to serve a double-role as a sort of DefKind (which #60462 properly adds).
Now, we can go back to only categorizing namespaces (at least for the variants with names in them).

r? @petrochenkov or @nikomatsakis cc @michaelwoerister

@eddyb eddyb force-pushed the namespaces-not-kinds branch from cb610a0 to 60f1944 Compare May 4, 2019 02:10
@eddyb eddyb changed the title [WIP] rustc: collapse relevant DefPathData variants into {Type,Value,Macro,Lifetime}Ns. rustc: collapse relevant DefPathData variants into {Type,Value,Macro,Lifetime}Ns. May 4, 2019
| DefPathData::ClosureExpr
| DefPathData::Ctor => Namespace::ValueNS,

DefPathData::MacroNs(..) => Namespace::MacroNS,

_ => Namespace::TypeNS,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could you use an exhaustive match here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally not using it because this are not really in the type namespace.
Maybe I should've made this function return -> Option<Namespace>, but it's really just a private hack.

ctor: variant.ctor_def_id.map(|did| did.index),
ctor_sig: None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this worked before.

@@ -157,13 +158,27 @@ crate fn program_clauses_for<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,
) -> Clauses<'tcx> {
// FIXME(eddyb) this should only be using `def_kind`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean introducing DefKind::Impl or something else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think DefKind should be able to describe everything with a DefId.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 4, 2019

📌 Commit 60f1944 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2019
@bors
Copy link
Contributor

bors commented May 5, 2019

⌛ Testing commit 60f1944 with merge d65e721...

bors added a commit that referenced this pull request May 5, 2019
rustc: collapse relevant DefPathData variants into {Type,Value,Macro,Lifetime}Ns.

`DefPathData` was meant to disambiguate within each namespace, but over the years, that purpose was overlooked, and it started to serve a double-role as a sort of `DefKind` (which #60462 properly adds).
Now, we can go back to *only* categorizing namespaces (at least for the variants with names in them).

r? @petrochenkov or @nikomatsakis cc @michaelwoerister
@bors
Copy link
Contributor

bors commented May 5, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: petrochenkov
Pushing d65e721 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 5, 2019
@bors bors merged commit 60f1944 into rust-lang:master May 5, 2019
@eddyb eddyb deleted the namespaces-not-kinds branch May 5, 2019 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants